# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: John Gerritse <tyrannis dot hawk at gmail dot com>

_name=pyspellchecker
pkgname=python-pyspellchecker
pkgver=0.7.2
pkgrel=2
pkgdesc='Pure python spell checker based on work by Peter Norvig'
arch=('any')
url=https://github.com/barrust/pyspellchecker
license=('MIT')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools'
             'python-wheel')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz")
sha256sums=('bc51ffb2c18ba26eaa1340756ebf96d0d886ed6a31d6f8e7a0094ad49d24550a')
b2sums=('075d683bd57184e825d45070e076fef6f5995d09712bdf8b16b1ae6fd286263e5196c391861b00c23398a2eda0eeb36aa92983ef2aa3359a67c6ee94eb2d4ed4')

build() {
  cd $_name-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/$_name-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
